package com.njupt.towersinfos.controller;

import com.njupt.towersinfos.domain.PreTowerCheck;
import com.njupt.towersinfos.domain.TowersCheckResult;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

@RestController
@RequestMapping("/tw")
@CrossOrigin("*")
public class CheckCtrl {
    @RequestMapping("/addTowerCheck")
    public String addCheck(PreTowerCheck ptc){
        return "{\"gencheck\":\"1234567\"}";
    }
    @RequestMapping("/modTowerCheck")
    public String checkResult(PreTowerCheck ptc){
        return "{\"checkres\":\"success\"}";
    }
    @RequestMapping("/findTowerCheckbyTowerid")
    public PreTowerCheck findCheck(String towerid){
        PreTowerCheck ptcc=PreTowerCheck.builder()
                .checkdate(LocalDate.now())
                .checker("张三")
                .company("中铁建十一局六公司")
                .manageid(5)
                .towerid("tj1234345")
                .markdate(LocalDate.now())
                .markname("无极")
                .result(TowersCheckResult.builder()
                        .checkid("tj111")
                        .broken(1)
                        .clear(1)
                        .ladder(1)
                        .limited(1)
                        .waterproof(1)
                        .resid(10)
                        .build())
                .build();
        return ptcc;
    }
    @RequestMapping("/delTowerCheck")
    public String delCheck(String checkid){
        return "{\"destorycheck\":\"success\"}";
    }



}
